import cs543.library.rmi.RmiServerInterface;
import cs543.library.rmi.RmiServerRegistry;
import org.json.JSONArray;

public class LocalAddition extends RmiServerInterface {
@Override
public void register () {
new RmiServerRegistry ().register ("Addition", this);
}
@Override
public JSONArray call (String method, JSONArray args) {
Addition obj = new Addition ();
if (method.equals ("sub")) {
try {
int r0 = args.getInt(0);
int r1 = args.getInt(1);
int ret = obj.sub (r0, r1);
JSONArray arr = new JSONArray ();
arr.put (ret);
return arr;
} catch (Exception e) {}
}
if (method.equals ("add")) {
try {
int r0 = args.getInt(0);
int r1 = args.getInt(1);
int ret = obj.add (r0, r1);
JSONArray arr = new JSONArray ();
arr.put (ret);
return arr;
} catch (Exception e) {}
}
return null;
}
}